package com.kingsoft.miot.bridge.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kingsoft.miot.bridge.dao.AuthUnitIdInfoDao;
import com.kingsoft.miot.bridge.exception.CommonException;
import com.kingsoft.miot.bridge.pojo.account.AuthUnitIdInfo;
import com.kingsoft.miot.bridge.service.AuthUnitIdInfoService;

/**
 * 
 * 认证服务
 * 
 * @author melody
 *
 */
@Service
public class AuthUnitIdInfoServiceImpl implements AuthUnitIdInfoService {

	@Autowired
	AuthUnitIdInfoDao authUnitIdInfoDao;

	@Override
	public AuthUnitIdInfo getAuthUnitIdWithRandom() {
		AuthUnitIdInfo authUnitIdInfo = null;
		try {
			authUnitIdInfo = authUnitIdInfoDao.getAuthUnitIdWithRandom();
		} catch (Exception e) {
			throw new CommonException(e);
		}
		return authUnitIdInfo;
	}

	@Override
	public int updateAuthUnitIdInfo(AuthUnitIdInfo authUnitIdInfo) {
		int flag = 0;
		try {
			flag = authUnitIdInfoDao.updateAuthUnitIdInfo(authUnitIdInfo);
		} catch (Exception e) {
			throw new CommonException(e);
		}
		return flag;
	}

}
